package com.game.Components;

import com.Math.Polygon2D;
import com.Math.Vector2D;
import com.pixels.Display;
import com.pixels.graphics.Drawer;

public abstract class Entity {
	
	double rotateSpeed;
	public Vector2D speed;
	public Vector2D pos;
	double direction;
	boolean alive = true;

	public boolean visible = true;

	public double radius;
	public Polygon2D polygon;
	
	int width = Display.WIDTH;
	int height = Display.HEIGHT;
	
	// call this super to set the start position and set the start direction
	public Entity(){
		direction = 0;
		pos = new Vector2D();
		speed = new Vector2D();
	}
	public Entity(double direction){
		this.direction = direction;
		pos = new Vector2D();
		speed = new Vector2D();
	}
	public Entity(int x, int y, double direction){
		this.direction = direction;
		pos = new Vector2D(x,y);
		speed = new Vector2D();
	}
	
	public abstract void draw(Drawer draw);
	
	public void boundaries() {
		if (pos.x > Display.WIDTH + radius) {
			pos.x = 0 - radius;
		} else if (pos.x < 0 - radius) {
			pos.x = Display.WIDTH + radius;
		}
		if (pos.y > Display.HEIGHT + radius) {
			pos.y = 0 - radius;
		} else if (pos.y < 0 - radius) {
			pos.y = Display.HEIGHT + radius;
		}
	}
	
}
